{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Setup OpenAI Agent\n",
    "import openai\n",
    "\n",
    "openai.api_key = \"sk-xxx\"\n",
    "from llama_index.agent.openai import OpenAIAgent"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from llama_index.tools.brave_search.base import BraveSearchToolSpec\n",
    "\n",
    "brave_tool = BraveSearchToolSpec(api_key=\"your-api-key\")\n",
    "agent = OpenAIAgent.from_tools(\n",
    "    brave_tool.to_tool_list(),\n",
    "    verbose=True,\n",
    ")\n",
    "\n",
    "print(agent.chat(\"whats the latest news about superconductors\"))"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "app-aCoYrWM5-py3.11",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
